package com.kborid.musicplayer.Tools;

import java.io.File;

import android.content.Context;
import android.os.Environment;

public class EnvironmentDir {

	private Context context;
	private static String PATH = "/Android/data/";
	private static String LRCDIR = "Lrc/";
	private static String CACHE = "cache/";
	private static EnvironmentDir instance = null;

	public static EnvironmentDir getInstance() {
		if (instance == null) {
			instance = new EnvironmentDir();
		}
		return instance;
	}

	public void setContext(Context context) {
		this.context = context;
	}

	private File getSDCardDirectory() {
		return Environment.getExternalStorageDirectory();
	}

	public String getApkPackageName() {
		return context.getPackageName();
	}

	public File getDataDirectory() {
		File f = new File(getSDCardDirectory() + PATH + getApkPackageName()
				+ "/");
		if (!f.exists()) {
			f.mkdir();
		}
		return f;
	}

	public File getLrcDirectory() {
		File f = new File(getSDCardDirectory() + PATH + getApkPackageName()
				+ "/" + LRCDIR);
		if (!f.exists()) {
			f.mkdir();
		}
		return f;
	}

	public File getCacheDirectory() {
		File f = new File(getSDCardDirectory() + PATH + getApkPackageName()
				+ "/" + CACHE);
		if (!f.exists()) {
			f.mkdir();
		}
		return f;
	}
}
